#include <bits/stdc++.h>

using namespace std;

class Solution {
public:
    vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
		if (nums1.size() > nums2.size()) swap(nums1, nums2);
		unordered_set<int> set(nums1.begin(), nums1.end());
		vector<int> res;
		for (int num: nums2) if (set.count(num)) {
			res.emplace_back(num);
			set.erase(num);
		}

		return res;
    }
private:
};

int main()
{
	Solution solution;
	return 0;
}
